<template>
  <view>
    <!-- 账单 -->
    <view>
      <view class="xiang_box" v-for="(i,n) in Datalist" :key="n">
        <view  class="flex" style="justify-content: space-between;">
          <view class="flex">
            <image  class="toimg" v-if="i.avatar" :src="i.avatar" mode=""></image>
            <view class="toimg" v-else></view>
            <view style="color: #ffffff;">{{i.nickname }}</view>
          </view>
          <view :class="i.type=='1'?'red':''">{{ i.type=='1'?'+':'-'}}{{i.amount}}</view>
        </view>
        <view class="xiang_cont">
          <view class="contentname">
            <view class="mr5">{{i.createtime_text }}</view>
            <view class="jianju">{{ i.shop_name }}</view>
          </view>
          <view v-if="i.order_sn" class="flex mr5 bottom-price" >
            <view>订单号：{{i.order_sn}}</view>
          </view>
          <view class="flex mr5 bottom-price" >
            <view>变动原因：{{i.memo}}</view>
          </view>
        </view>
      </view>
      <!-- 空置页 -->
      <shopro-empty v-if="isEmpty" marginTop="200rpx" :image="$IMG_URL + '/imgs/empty/no_data.png'" tipText="暂无数据~">
      </shopro-empty>
      <!-- 更多 -->
      <u-loadmore v-show="!isEmpty" height="80rpx" :status="loadStatus" icon-type="flower" color="#d4d4d4" />
    </view>
  </view>
</template>
<script>
// import {orderslist,storeLists} from '@/api/merchat.js'
export default {
  data() {
    return {
      page:1,
      lastPage:0,
      Datalist:[],
      statusText:"",
      array:[],
      index:0,
      isEmpty: true,
      loadStatus: 'loadmore', //loadmore-加载前的状态，loading-加载中的状态，nomore-没有更多的状态
    };
  },
  onLoad() {
    this.orderslist()
  },
  onReachBottom:function(){
    this.page++
    if(this.page>this.lastPage){
      return
    }
    this.orderslist()
  },
  methods:{
    orderslist(){
      this.$http_business('order.offerListnew',{
        token:uni.getStorageSync('token'),
        page:this.page
      }).then(res => {
        console.log(res)
        if (res.code === 1) {
          console.log(res)
          this.lastPage = res.data.last_page
          this.statusText = res.data.last_page==this.page?"暂无更多数据":"上拉加载"
          this.Datalist =[...this.Datalist,...res.data.data]
          this.isEmpty = !this.Datalist;
          this.loadStatus = this.page < res.data.last_page ? 'loadmore' : 'nomore';
        }
      });
    }
  }
}

</script>

<style lang="scss" scoped>

.gechang{
  display: flex;
}
.mingbox{
  padding: 30rpx;
  color: #ffffff;
}
.marg{
  margin: 16rpx 0;
}
.xiang_box{
  width: 100%;
  background: #13114c;
  box-shadow: 52px 1px 0px 0px #EEEEEE;
  padding: 30rpx;
  border-bottom: 1px solid rgba(0,0,0,.05);
  .toimg{
    width: 44rpx;
    height: 44rpx;
    border-radius: 10rpx;
    background-color: #4f83fd;
    margin-right: 20rpx;
  }
}
.flex{
  display: flex;
}
.xiang_cont{
  margin: 0 0 0 64rpx;
  color: #999999;
  font-size: 13px;
  .contentname{
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}
.mr5{
  margin-top: 5px;
}
.red{
  color:#e9c83ce8;
}
//.bottom-price{
//  font-size: 26rpx;
//}
</style>
